package com.andryyu.learn.module

import android.content.Context
import com.andryu.jni.module.NdkModule
import com.andryu.base.entity.LearnHeaderEntity
import com.andryu.base.entity.LearnListEntity
import com.andryu.base.entity.LearnVideoPageEntity
import com.andryu.third.TutorialThirdActivity
import com.andryu.opengl.module.OpenglDataModule
import com.andryu.video.NaviVideoType
import com.andryu.video.TutorialVideoActivity
import com.andryyu.kotlin.self.TutorialSelfActivity
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ActivityComponent
import dagger.hilt.android.qualifiers.ApplicationContext
import javax.inject.Inject
import javax.inject.Named

@InstallIn(ActivityComponent::class)
@Module
class AppModule {

    @Inject
    @Named("NdkLastThree")
    lateinit var ndkTopData: List<LearnListEntity>
    @Inject
    @Named("OpenglLastThree")
    lateinit var openglTopData: List<LearnListEntity>



    @Provides
    @Named("VideoList")
    fun provideVideoList(@ApplicationContext context: Context): MutableList<LearnVideoPageEntity<*>> {
        val mDataList = mutableListOf<LearnVideoPageEntity<*>>()
        val ndkEntity = LearnVideoPageEntity("NDK", TutorialVideoActivity::class.java)
        ndkEntity.dataList = NdkModule.provideOpenglTopThree().toMutableList()
        val openglEntity = LearnVideoPageEntity("OpenGLES", NaviVideoType.NAVI_VIDEO_OPENGL, TutorialVideoActivity::class.java)
        openglEntity.dataList = OpenglDataModule.provideOpenglTopThree(context).toMutableList()
        val grifikaEntity = LearnVideoPageEntity("Grifika", NaviVideoType.NAVI_VIDEO_GRIFIKA, TutorialVideoActivity::class.java)
        val ffmpegEntity = LearnVideoPageEntity("FFmpeg", NaviVideoType.NAVI_VIDEO_FFMPEG,TutorialVideoActivity::class.java)
        mDataList.add(ndkEntity)
        mDataList.add(openglEntity)
        mDataList.add(grifikaEntity)
        mDataList.add(ffmpegEntity)
        return mDataList
    }

    @Provides
    @Named("ComponentList")
    fun provideComponentList():MutableList<LearnHeaderEntity<*>>{
        val mDataList = mutableListOf<LearnHeaderEntity<*>>()
        mDataList.add(LearnHeaderEntity("Jetpack", TutorialSelfActivity::class.java))
        return mDataList
    }

    @Provides
    @Named("ThirdList")
    fun provideThirdList():MutableList<LearnHeaderEntity<*>>{
        val mDataList = mutableListOf<LearnHeaderEntity<*>>()
        mDataList.add(LearnHeaderEntity("Rxjava", TutorialThirdActivity::class.java))
        return mDataList
    }

    @Provides
    @Named("AlgorithmList")
    fun provideAlgorithmList():MutableList<LearnHeaderEntity<*>>{
        val mDataList = mutableListOf<LearnHeaderEntity<*>>()
        return mDataList
    }
}